<template>
  <!-- 顶部通栏 -->
  <AppTopnav></AppTopnav>
  <!-- 头部 -->
  <AppHeader></AppHeader>
  <!-- 吸顶头部
  1:创建一个吸顶组件
  2：拿到scrollTop的值对吸顶组件做控制处理
      做一个滚动监听  window.addEventlistener('scroll',()=>{取到scrollTop}) 
      scrollTop有兼容性问题
      document.documentElement.scrollTop || document.body.scrollTop || window.pageYoffset  
   -->
  <AppHeaderSticky></AppHeaderSticky>
  <main>
    <!-- 二级路由 -->
    <!-- <transition name="fade" mode="out-in"> -->
    <router-view></router-view>
    <!-- </transition> -->
  </main>
  <!-- 底部 -->
  <AppFooter></AppFooter>
</template>

<script>
import AppTopnav from '@/components/app-topnav.vue'
import AppHeader from '@/components/app-header.vue'
import AppFooter from '@/components/app-footer.vue'
import AppHeaderSticky from '@/components/app-header-sticky.vue'
import { useStore } from 'vuex'
export default {
  name: 'xtx-layout',
  components: {
    AppTopnav,
    AppHeader,
    AppFooter,
    AppHeaderSticky
  },
  setup () {
    const store = useStore()
    store.dispatch('category/getList')
  }
}
</script>

<style scoped lang="less">
// @import url(~@/assets/styles/variables.less);
.header {
  color: @helpColor;
}
</style>
